package controller.menubar.commands;

import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.text.MessageFormat;
import javax.swing.JTable;

import view.MainFrame;

public class PrintTable implements Printable , ActionListener{

	
	public PrintTable(MainFrame frame) {
		this.frame = frame;		
	}	
	
	@Override
	public int print(Graphics arg0, PageFormat arg1, int arg2)
			throws PrinterException {
		
		return 0;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		MessageFormat header = new MessageFormat("{0,number,integer}");	
		try {
			frame.getMainPanel().getPrimary().getDiskContent().getTable().print(JTable.PrintMode.FIT_WIDTH, header, null);
		} catch (PrinterException e) {
			e.printStackTrace();
		}
		
	}
	
	
	
	private MainFrame frame;



	

}
